﻿using Architecture.API.Application.Command.RequestForLeaveCommand;
using Architecture.Domain;
using Architecture.Domain.Service.UserInfoRoleServices;
using Architecture.Domain.Service.UserInfoServices;
using MediatR;

namespace Architecture.API.Application.CommandHandlers.RequestForLeaveHandler
{
    /// <summary>
    /// 
    /// </summary>
    public class UserReverseFillingCommandHandler : IRequestHandler<UserReverseFillingCommand, UserInfo>
    {
        /// <summary>
        /// 角色信息服务
        /// </summary>
        protected readonly IUserInfoService userInfoService;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="userInfoService">角色信息服务</param>
        public UserReverseFillingCommandHandler(IUserInfoService userInfoService)
        {
            this.userInfoService = userInfoService;
        }

        /// <summary>
        /// 反填角色信息
        /// </summary>
        /// <param name="request">请求</param>
        /// <param name="cancellationToken">取消标记</param>
        /// <returns>反填角色信息</returns>
        public async Task<UserInfo> Handle(UserReverseFillingCommand request, CancellationToken cancellationToken)
        {
            return await userInfoService.GetModelAsync(request.UserId);
        }
    }
}
